package com.web.dao;

import com.web.entity.ReportInfo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface ReportInfoMapper {
    @Delete({
        "delete from APP_REPORT_INFO",
        "where report_id = #{reportId,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer reportId);

    @Insert({
        "insert into APP_REPORT_INFO (report_id, title, ",
        "sort, create_time, ",
        "modify_time)",
        "values (#{reportId,jdbcType=INTEGER}, #{title,jdbcType=VARCHAR}, ",
        "#{sort,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ",
        "#{modifyTime,jdbcType=TIMESTAMP})"
    })
    int insert(ReportInfo record);

    int insertSelective(ReportInfo record);

    @Select({
        "select",
        "report_id, title, sort, create_time, modify_time",
        "from APP_REPORT_INFO",
        "where report_id = #{reportId,jdbcType=INTEGER}"
    })
    @ResultMap("BaseResultMap")
    ReportInfo selectByPrimaryKey(Integer reportId);

    int updateByPrimaryKeySelective(ReportInfo record);

    @Update({
        "update APP_REPORT_INFO",
        "set title = #{title,jdbcType=VARCHAR},",
          "sort = #{sort,jdbcType=INTEGER},",
          "create_time = #{createTime,jdbcType=TIMESTAMP},",
          "modify_time = #{modifyTime,jdbcType=TIMESTAMP}",
        "where report_id = #{reportId,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(ReportInfo record);

    List<ReportInfo> getAllReportInfo();
}